"""
File:01_property属性.py
Author: anning
Date:-04-07
Connect:792910452@qq.com
Description:
"""
class Good(object):
    def __init__(self,name,price):
        self.name=name
        self.__price=price

    @property #将类方法变成类属性
    def price(self):
        return self.__price

    @price.setter
    def price(self,value):
        if self.__price>=100:
            self.__price=value

if __name__ == '__main__':
    good=Good('python book',100)
    print(good.price)
    good.price=1000
    print(good.price)